<?php
include_once "util.php";
$start = 151;
$end = 4765;
$orders = [];
for ($orderId = $start; $orderId <= $end; $orderId++) {
    $content = getHTML("http://xh.ecustqks.com/index.php?m=members&a=orderdetail&id={$orderId}", false);
    preg_match('/订单编号：(.*)<\/p>/siU', $content, $match);
    $orderInfo = [];
    $orderInfo['campus'] = '徐汇';
    $orderInfo['orderId'] = $match[1];
    preg_match('/下单时间：(.*)<\/p>/siU', $content, $match);
    $orderInfo['orderTime'] = $match[1];
    preg_match('/送达时间：(.*)<\/p>/siU', $content, $match);
    $orderInfo['deliverTime'] = $match[1];
    preg_match('/完成时间：(.*)<\/p>/siU', $content, $match);
    $orderInfo['doneTime'] = $match[1];
    preg_match('/客户姓名：(.*)<\/p>/siU', $content, $match);
    $orderInfo['name'] = $match[1];
    preg_match('/手机号码：(.*)<\/p>/siU', $content, $match);
    $orderInfo['cellphone'] = $match[1];
    preg_match('/收货地址：(.*)<\/p>/siU', $content, $match);
    $orderInfo['address'] = $match[1];
    preg_match('/订单备注：(.*)<\/p>/siU', $content, $match);
    $orderInfo['note'] = $match[1];
    preg_match('/订单总额：<span class="orderd">(.*)<\/span>元/siU', $content, $match);
    $orderInfo['totalCost'] = $match[1];
    if (isset($orderInfo['totalCost'])) $orders[] = $orderInfo;
    echo "Done: {$orderId}/{$end}\n";
}
$start = 1010;
$end = 4668;
for ($orderId = $start; $orderId <= $end; $orderId++) {
    $content = getHTML("http://fx.ecustqks.com/index.php?m=members&a=orderdetail&id={$orderId}", false);
    preg_match('/订单编号：(.*)<\/p>/siU', $content, $match);
    $orderInfo = [];
    $orderInfo['campus'] = '奉贤';
    $orderInfo['orderId'] = $match[1];
    preg_match('/下单时间：(.*)<\/p>/siU', $content, $match);
    $orderInfo['orderTime'] = $match[1];
    preg_match('/送达时间：(.*)<\/p>/siU', $content, $match);
    $orderInfo['deliverTime'] = $match[1];
    preg_match('/完成时间：(.*)<\/p>/siU', $content, $match);
    $orderInfo['doneTime'] = $match[1];
    preg_match('/客户姓名：(.*)<\/p>/siU', $content, $match);
    $orderInfo['name'] = $match[1];
    preg_match('/手机号码：(.*)<\/p>/siU', $content, $match);
    $orderInfo['cellphone'] = $match[1];
    preg_match('/收货地址：(.*)<\/p>/siU', $content, $match);
    $orderInfo['address'] = $match[1];
    preg_match('/订单备注：(.*)<\/p>/siU', $content, $match);
    $orderInfo['note'] = $match[1];
    preg_match('/订单总额：<span class="orderd">(.*)<\/span>元/siU', $content, $match);
    $orderInfo['totalCost'] = $match[1];
    if (isset($orderInfo['totalCost'])) $orders[] = $orderInfo;
    echo "Done: {$orderId}/{$end}\n";
}
dumpVariableToFile($orders, 'orders.php', 'orders');